/*
 * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import java.util.Random;

/**
 * <p>Project: javase - Rand1
 * <p>Powered by webrx On 2021-11-23 15:53:42
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Rand1 {
    public static void main(String[] args) {
        var rand = new Random();
        System.out.println(rand.nextBoolean());
        System.out.println(rand.nextLong());
        System.out.println(rand.nextInt());
        System.out.println(rand.nextInt(3)); //0-2
        System.out.println(rand.nextDouble());
        System.out.println(rand.nextFloat());
        System.out.println(rand.nextFloat(3));//>0.000001 <3 的小数

        int rr = rand.nextInt(256);
        int gg = rand.nextInt(256);
        int bb = rand.nextInt(256);
        System.out.printf("#%02x%02x%02x%n", rr, gg, bb);

        //System.out.println(rand.nextGaussian());

        var ss = new String[]{"李四", "张三", "王五"};

        //0-2
        System.out.println(ss[rand.nextInt(ss.length)]);

    }
}
